Repository navigation
release: 0.150.0 - #221
release: 0.150.0#221
Conversation
Stainless-Generated-From: eef5607d14d320431f3356f9a78894d30757f4a0
* feat: add workload identity federation credentials Kernel and AsyncKernel accept credentials= and can resolve workload identity federation from the environment. The client exchanges the workload's own identity token for a short-lived access token, caches it, refreshes it before expiry and retries a 401 once with a new exchange. Adds built-in identity token sources for GitHub Actions, the Google Cloud metadata server, AWS STS (optional boto3 extra), a token file and a single-use static token, plus a one-shot exchange function. * Make the replay hint depend on the identity token source A token file that was not rotated is not a static token, so the hint now names the file and says to rotate it, and callbacks and the one-shot exchange get their own wording. invalid_target errors say how to set resource. * Log only the type of a provider's exception on background refresh failure A caller's credentials provider can raise an exception whose text quotes a token. The background-refresh warning now prints the message only for the SDK's own WorkloadIdentityError, and the exception type for anything else. --------- Co-authored-by: rgarcia <72655+rgarcia@users.noreply.github.com>
| if not direct_vm_request_body_is_replayable(response.request): | ||
| return False | ||
| _unauthorized_retry_used.set(True) | ||
| return True |
There was a problem hiding this comment.
Rejected token survives zero retries
High Severity
A 401 drops the cached access token only when _should_retry runs, and the base client skips that call whenever remaining_retries is 0. vault.perform_operation copies the client with max_retries=0, so a rejected federation token stays cached and every later call keeps sending it until it expires on its own.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 07c1a18. Configure here.
| except RuntimeError: | ||
| # Threads cannot be started while the interpreter shuts down. The | ||
| # cached token is still valid, so skip this refresh. | ||
| self._land(flight, None, None) |
There was a problem hiding this comment.
Background refresh races httpx client
Medium Severity
Advisory token refresh starts a daemon thread that POSTs through the same httpx.Client the caller immediately uses for the API request. httpx.Client is not thread-safe, so during the last ~2 minutes of each access-token lifetime those two sends can corrupt the pool or mix up responses.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 07c1a18. Configure here.
Merge the sealed captcha_solver build into main
07c1a18 to
547085d
Compare
Stainless-Generated-From: 9a34d670fa00a07ff3c5ab572aabe77b31db4fe0
547085d to
136fdc0
Compare
| return True | ||
| return super()._should_retry(response) | ||
|
|
||
| request = with_unauthorized_retry_scope(SyncAPIClient.request) |
There was a problem hiding this comment.
401s skip workload token invalidation
Medium Severity
Rejected workload-identity access tokens are dropped only inside _should_retry, which the base client calls when retries remain. With max_retries=0 (including vault.perform_operation) or on a terminal 401, TokenCache.reject never runs, so the next call reuses the same rejected bearer token until a time-based refresh.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 136fdc0. Configure here.
Stainless-Generated-From: a199339b9b3f743c7924828ce6577dc933a3a627
136fdc0 to
1f0e586
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
There are 4 total unresolved issues (including 3 from previous reviews).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 1f0e586. Configure here.
| return _Step(entry.token, self._new_flight_locked(new_event(), advisory=True)) | ||
| if self._flight is not None: | ||
| return _Step(None, self._flight) | ||
| return _Step(None, self._new_flight_locked(new_event(), advisory=False), lead=True) |
There was a problem hiding this comment.
Advisory refresh failure fails live requests
Medium Severity
When a cached token enters the mandatory refresh window while an advisory refresh is still in flight, waiters share that advisory call. If the background refresh fails, _raise_shared_failure raises to those waiters even though advisory failures are meant to be non-fatal and the previous token may still be valid. Concurrent get_token / async_get_token callers can then fail authentication instead of starting a mandatory refresh or using the cached token.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 1f0e586. Configure here.
…ion in egress Stainless-Generated-From: 145e06596826febc68ec45e6e9a467b2c17e6e00
1f0e586 to
3ef4148
Compare


Automated Release PR
0.150.0 (2026-11-19)
Features
browser_idwhen authorizing a Kernel card: Evervault alias cards route that browser through the card vault's proxy as soon as the cardholder enters a fresh CVC (9d1fc90)captcha_solverto browser creation;stealthis deprecated in favor ofcaptcha_solverandproxy(9d1fc90)BrowserFingerprintrecords to browsers, applied at claim time (9d1fc90)line_itemsto AgentCard card specs, passed through to checkout authorizations (9d1fc90)source_ipcondition to API key policies (9d1fc90)PATCH /org/api_keys/{id}, and link API keys to service accounts (9d1fc90)This pull request is managed by Stainless's GitHub App.
The semver version number is based on included commit messages. Alternatively, you can manually set the version number in the title of this pull request.
For a better experience, it is recommended to use either rebase-merge or squash-merge when merging this pull request.
🔗 Stainless website
📚 Read the docs
🙋 Reach out for help or questions
Note
High Risk
Adds authentication and token-exchange logic on every API call; misconfiguration or cache/retry bugs could break all requests, and API key policy changes affect authorization behavior.
Overview
0.150.0 ships a full workload identity federation path for the Python client:
Kernel/AsyncKernelcan authenticate viacredentials=(or env such asKERNEL_FEDERATION_RULE_ID) instead of a static API key, with token exchange, caching, refresh, and a single 401 retry. Public exports includeWorkloadIdentityCredentials, built-in identity sources (GitHub Actions, GCP metadata, AWS STS via optionalkernel[aws]), andexchange_federation_assertion.Browser and pool APIs gain explicit
captcha_solver(and related types/docs);stealthis deprecated and described as overlapping withcaptcha_solver+proxy. Fingerprints now support linux as well as macos and tie to captcha solving instead of stealth alone.Org API keys in the SDK mirror server changes: create keys linked to
service_account_id, PATCH can replacepolicyin place (includingsource_ipconditions), and models expose principal / policy conditions. Auth context types add workload identity fields and effective policy for service accounts.Reviewed by Cursor Bugbot for commit 954cb49. Bugbot is set up for automated code reviews on this repo. Configure here.